package com.woniuxy.main.provider;

import org.apache.ibatis.jdbc.SQL;

import com.woniuxy.main.pojo.Room;


public class RoomProvider {
	
public String provideSql(Room room) {
		
		SQL sql = new SQL().SELECT("*").FROM("room");
		//房号
		if(room.getRoomnum()!=null && room.getRoomnum().length() !=0) {
			sql.WHERE("roomnum like '%"+room.getRoomnum()+"%'");
		}
		//类型
		if(room.getRoomtype_id() !=0) {
			sql.WHERE("roomtype_id ="+room.getRoomtype().getRoomtype_id());
		}
		//状态
		if(room.getStatus() !=0) {
			sql.WHERE("status ="+room.getStatus());
		}

	   //房间id
	if(room.getRoom_id() !=0) {
		sql.WHERE("room_id ="+room.getRoom_id());
	}

		return sql.toString();
		
	}
	


public String loadRoomSql() {
	
	SQL sql = new SQL().SELECT("*").FROM("room");

	return sql.toString();
	
}
}
